Skip to content

Add cuDSS-style block CSR interface for solver creation#9

Open
robtaylor wants to merge 1 commit intofacebookresearch:mainfrom
ChipFlow:pr/csr-interface
Open

Add cuDSS-style block CSR interface for solver creation#9
robtaylor wants to merge 1 commit intofacebookresearch:mainfrom
ChipFlow:pr/csr-interface

Conversation

@robtaylor
Copy link

Summary

Adds a cuDSS-style CSR interface for creating solvers from block CSR matrices:

New Files

  • CsrTypes.h: Enums for MatrixType, MatrixView, IndexBase, IndexType
  • CsrSolver.h/cpp: BlockCsrDescriptor struct and createSolverFromBlockCsr() function
  • CsrSolverTest.cpp: Comprehensive unit tests

API

struct BlockCsrDescriptor {
    int64_t numBlocks;
    int64_t numBlockNonzeros;
    const void* rowStart;      // INT32 or INT64
    const void* colIndices;    // INT32 or INT64
    const int64_t* blockSizes;
    IndexType indexType;       // INDEX_INT32, INDEX_INT64
    MatrixType mtype;          // MTYPE_SPD (only SPD supported)
    MatrixView mview;          // MVIEW_LOWER, MVIEW_UPPER, MVIEW_FULL
    IndexBase indexBase;       // BASE_ZERO, BASE_ONE
};

SolverPtr createSolverFromBlockCsr(const Settings& settings, 
                                    const BlockCsrDescriptor& desc, ...);

Features

  • Supports both int32 and int64 indices
  • Supports zero-based and one-based indexing
  • Lower/upper triangular views (auto-transposed as needed)
  • loadFromCsr() / extractToCsr() for value mapping with permutation handling

Tests

8 unit tests covering:

  • Structure conversion
  • Index type handling (INT32/INT64)
  • Base handling (zero/one)
  • Invalid matrix type rejection
  • Full factor+solve workflow

Dependencies

None - this PR is independent and can be merged at any time.

Test Plan

  • All 8 CSR solver tests pass
  • Existing tests unaffected

🤖 Generated with Claude Code

Introduces a new API for creating solvers from block CSR matrices,
modeled after NVIDIA's cuDSS library interface:

- CsrTypes.h: Enums for MatrixType, MatrixView, IndexBase, IndexType
- CsrSolver.h/.cpp: BlockCsrDescriptor and createSolverFromBlockCsr()
- Solver.h/.cpp: loadFromCsr() and extractToCsr() for value loading
- CsrSolverTest.cpp: Unit tests covering structure conversion, index
  types, base handling, and full factor+solve workflow

The block CSR interface provides a natural entry point for users with
existing sparse matrix data, supporting both int32 and int64 indices,
zero and one-based indexing, and lower/upper triangular views.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude claude-opus-4-5-20251101
@meta-cla
Copy link

meta-cla bot commented Jan 2, 2026

Hi @robtaylor!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant